package sqlgen

type LoadColumn struct {
	Column     string
	DType      uint
	Required   bool
	Check      string
	Enum       []int
	Conversion func(s string) (any, error)
}

const (
	DTypeInt = iota
	DTypeReal
	DTypeText
	DTypeID
	DTypeEnum
)

type LoadTable struct {
	File      string
	Doc       string
	TableSpec TableSpec
}

type ComputedTable struct {
	Name          string
	Doc           string
	View          string
	SourcePair    bool
	CacheOnTables []string
	TableSpec     TableSpec
}

type View struct {
	Name          string
	SQLSelectFile string
	Doc           string
}

type TableSpec struct {
	Table     string
	UniqueSet []string
	Columns   []LoadColumn
	Indexes   [][]string
	Optional  bool
}

type LoadSchema struct {
	TablesGTFS          []LoadTable
	TablesComputed      []ComputedTable
	TableSystemTracking TableSpec
	TableSystemMDB      TableSpec
	Views               []View
}
